ARD2  1.00 for Rev B. Hardware
Airbag Reference Demonstrator using MPC5604P
GUI_State.h
Go to the documentation of this file.
00001 
00017 #ifndef GUI_STATE_H_
00018 #define GUI_STATE_H_
00019 
00020 /*
00021  **************************************************************
00022  * Defines, Macros and Typedefs 
00023  **************************************************************/
00024 /*** Constant Macros ***/
00025 /* Default Yes and No defines */
00026 #ifndef TRUE
00027  #define TRUE (1u)
00028 #endif
00029 #ifndef CLEAR
00030  #define CLEAR (0u)
00031 #endif
00032 #ifndef BITS_IN_NIBBLE
00033  #define BITS_IN_NIBBLE (4u)
00034 #endif
00035 #ifndef BITS_IN_BYTE
00036  #define BITS_IN_BYTE (8u)
00037 #endif
00038 #ifndef BYTES_IN_16
00039  #define BYTES_IN_16  (2u)
00040 #endif
00041 #ifndef BYTES_IN_32
00042  #define BYTES_IN_32  (4u)
00043 #endif
00044 
00045 #ifndef BIT_DEFINITION
00046  #define BIT_DEFINITION
00047  #define BIT0  (1u << 0u)
00048  #define BIT1  (1u << 1u)
00049  #define BIT2  (1u << 2u)
00050  #define BIT3  (1u << 3u)
00051  #define BIT4  (1u << 4u)
00052  #define BIT5  (1u << 5u)
00053  #define BIT6  (1u << 6u)
00054  #define BIT7  (1u << 7u)
00055  #define BIT8  (1u << 8u)
00056  #define BIT9  (1u << 9u)
00057  #define BIT10 (1u << 10)
00058  #define BIT11 (1u << 11)
00059  #define BIT12 (1u << 12)
00060  #define BIT13 (1u << 13)
00061  #define BIT14 (1u << 14)
00062  #define BIT15 (1u << 15)
00063  #define BIT16 (1u << 16)
00064  #define BIT17 (1u << 17)
00065  #define BIT18 (1u << 18)
00066  #define BIT19 (1u << 19)
00067  #define BIT20 (1u << 20)
00068  #define BIT21 (1u << 21)
00069  #define BIT22 (1u << 22)
00070  #define BIT23 (1u << 23)
00071  #define BIT24 (1u << 24)
00072  #define BIT25 (1u << 25)
00073  #define BIT26 (1u << 26)
00074  #define BIT27 (1u << 27)
00075  #define BIT28 (1u << 28)
00076  #define BIT29 (1u << 29)
00077  #define BIT30 (1u << 30)
00078  #define BIT31 (1u << 31)
00079 #endif
00080 
00081 #define GUI_STATE_RUN_HAS_BEEN_EXECUTED ((uint8_t)0xA5u)
00082 #define N_GUI_ARGS ((uint8_t)3u)
00083 
00084 /*** Function Macros ***/
00085 #ifndef N_ELEMENTS
00086  #define N_ELEMENTS(X)           (sizeof(X)/sizeof(*(X)))
00087 #endif
00088 
00089 /*** Enums ***/
00090 
00091 
00092 /*** TypeDefs ***/
00093 typedef union
00094 {
00095   struct
00096   {
00097     uint8_t Cmd;
00098     uint8_t Arg1;
00099     uint8_t Arg2;
00100     uint8_t Arg3;
00101   } P;
00102   
00103   uint8_t A[4];
00104   
00105   uint32_t W;
00106 } GUICmd_t;
00107 
00108 typedef union
00109 {
00110   uint8_t A[4];
00111 } GUICmdString_t;
00112 /*
00113  **************************************************************
00114  * Declarations 
00115  **************************************************************/
00116 /*** Global ***/
00117 /*** Static ***/
00118 
00119 /*** Constant ***/
00120 /*
00121  **************************************************************
00122  * Function Prototypes 
00123  **************************************************************/
00124 /*
00125  ******************************************************************************
00126  *
00127  * Function:          u32fnGUISwitchCase()
00128  *
00129  */
00146 uint32_t u32fnGUISwitchCase(const uint8_t* pu8Cmd, 
00147                             uint8_t* pu8RawResponse, 
00148                             uint8_t* pu8Size,
00149                             uint8_t* pu8TextResponse,
00150                             uint8_t* pu8TextSize);
00151 /*
00152  ******************************************************************************
00153  *
00154  * Function:          vfnGUIStateFormatCurveData()
00155  *
00156  */
00165 void vfnGUIStateFormatCurveData(uint16_t* au16LabviewData);
00166 /*
00167  ******************************************************************************
00168  *
00169  * Function:          u32fnGUISendResponseFrame()
00170  *
00171  */
00188 uint32_t u32fnGUISendResponseFrame(const uint8_t* pu8Cmd,
00189                                    const uint8_t* pu8RawResponse, 
00190                                    const uint8_t* pu8Size,
00191                                    const uint8_t* pu8TextResponse,
00192                                    const uint8_t  u8TextSize);
00193 /*
00194  ******************************************************************************
00195  *
00196  * Function:          vfnGUISBCCapTests()
00197  *
00198  */
00211 void vfnGUISBCCapTests(uint8_t* pu8Size, uint8_t* pu8RawResponse,
00212                        uint8_t u8ERx, uint8_t u8Test);
00213 /*
00214  ******************************************************************************
00215  *
00216  * Function:          vfnGUISBCLeakageTests()
00217  *
00218  */
00230 void vfnGUISBCLeakageTests(const uint8_t cu8Side,
00231                            const uint8_t cu8Squib, 
00232                            const uint8_t cu8LeakageType, 
00233                            uint8_t* pu8Result);
00234 /*
00235  ******************************************************************************
00236  *
00237  * Function:          vfnGUICheckSatellites()
00238  *
00239  */
00252 void vfnGUICheckSatellites(const uint16_t* pu16Mask, 
00253                            uint8_t* pu8Result);
00254 /*
00255  ******************************************************************************
00256  *
00257  * Function:          vfnVerifyValidityOfCmd()
00258  *
00259  */
00273 void vfnVerifyValidityOfCmd(const uint8_t* pu8Cmd, 
00274                             const GUICmdString_t* ptValidCmd,
00275                             const uint16_t u16TableSize,
00276                             uint8_t* pu8Result);
00277 /*
00278  ******************************************************************************
00279  *
00280  * Function:          vfnGUISatAndSquibState()
00281  *
00282  */
00292 void vfnGUISatAndSquibState(const uint8_t u8Mode, const uint16_t cu16Step);
00293 #endif /* GUI_STATE_H_ */